<%--
  Created by IntelliJ IDEA.
  User: hyp1202
  Date: 2018/7/6
  Time: 17:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%@ include file="/WEB-INF/views/modules/commons/head.jsp"%>
    <!-- 复选框 -->
    <link rel="stylesheet" href="<s:url value="/assets/web/common/lulu_zujian/ui.css"></s:url>">
        <link rel="stylesheet" href="<s:url value="/assets/web/css/agent/agent_upload.css"></s:url>">
    <style>
        #content-main{
            padding: 20px 20px;
        }
        /* 上传备件材料 模板 */
        .agent-upload .project-jd {
            width:100%;
        }
        .agent-upload .project-jd>:nth-child(1) {
            color: black;
            font-size: 18px;
        }
    </style>
        <title>上传备件材料</title>
</head>
<body style="margin:0;padding: 0;" class="bgcolor">
<%@ include file="/WEB-INF/views/modules/commons/nav.jsp" %>
<%@ include file="/WEB-INF/views/modules/commons/menu.jsp" %>
<table></table>
<div class="av row J_mainContent clear" id="content-main">

    <!-- 上传备件材料 -->
    <%--<div class="agent-upload" style="display:block;">--%>
        <%--<div class="project-template">--%>
            <%--<p class="text-center hidden-font" data-id="" title="重大项目节点任务模板">重大项目节点任务模板</p>--%>
            <%--<div class="node-content">--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.1业主备件</span>--%>
                <%--</div>--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.2第三方编制单位</span>--%>
                <%--</div>--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.3建议书批复</span>--%>
                <%--</div>--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.4勘测测绘红线图</span>--%>
                <%--</div>--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.5计划选址论证报告编制</span>--%>
                <%--</div>--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.6规划选址意见书</span>--%>
                <%--</div>--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.7规划选址意见书</span>--%>
                <%--</div>--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.8规划选址意见书11111111111111111111111111111111111111</span>--%>
                <%--</div>--%>

                <%--<div class="project-jd">--%>
                    <%--<span>1.3建议书批复</span>--%>
                <%--</div>--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.4勘测测绘红线图</span>--%>
                <%--</div>--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.5计划选址论证报告编制</span>--%>
                <%--</div>--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.6规划选址意见书</span>--%>
                <%--</div>--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.7规划选址意见书</span>--%>
                <%--</div>--%>
                <%--<div class="project-jd">--%>
                    <%--<span>1.8规划选址意见书</span>--%>
                <%--</div>--%>

                <%--<input class="col-sm-4" type="file" id="fileupload" name="files" accept=".zip"/>--%>
                <%--<button class="upload">上传</button>--%>
                <%--<button class="download">下载</button>--%>
            <%--</div>--%>
        <%--</div>--%>
    <%--</div>--%>

    <c:forEach items="${map}" var="map">
        <div class="agent-upload" style="display:block;">
            <div class="project-template">
                <p class="text-center hidden-font"  title="${map.key.nodeId}${map.key.nodeName}">${map.key.nodeId}${map.key.nodeName}</p>
                <div class="node-content">
                    <c:forEach items="${map.value}" var="list" varStatus="vs">
                        <div class="project-jd">
                            <span title="${list.acceptNodeId}  ${list.fileName}">${vs.count}  ${list.fileName}</span>
                        </div>

                    </c:forEach>
                    <div class="upload-download">
                        <input  style="display: inline-block;" type="file" id="${map.value[0].nodeId}" name="files" accept=".zip"/>
                        <button class="upload" data-id="${map.value[0].nodeId}" >上传</button>
                        <c:if test="${!empty map.key.nodeFilter}">
                        <button class="download" onclick="downDetail(${map.value[0].nodeId})">下载</button>
                        </c:if>
                        <c:if test="${empty map.key.nodeFilter}">

                        </c:if>
                    </div>
                </div>
            </div>
        </div>
    </c:forEach>

</div>
<%@ include file="/WEB-INF/views/modules/commons/foot.jsp" %>
<!--上传备件材料css -->
<script src="<s:url value="/assets/web/js/agent/agent_upload.js"></s:url>"></script>
<script src="<s:url value="/assets/web/js/ajaxfileupload.js"></s:url>"></script>

<script>

    $(function(){
        // 点击显示或隐藏二级列表
        $("#audit").parent().hover(
            function () {
                $(this).children(".nav-second-level").show();
            },
            function () {
                $(this).children(".nav-second-level").hide();
            }
        )


    //    给节点名称添加隐藏class
        $(".project-jd>span").addClass('hidden-font');


    })

    //    上传
//    $("#dialog").hide();
    $(".upload").click(function() {
        var fileval = $(this).prev().val();
        console.log(fileval);
        var fileId = $(this).prev().attr("id");
        console.log(fileId);
        if (fileval == null || fileval == "") {
            alert("未选择任何文件");
            return;
        }

        $("#dialog").show();
        var dat= {"sysId":$(this).data("id")};
        console.log(dat);
        $.ajaxFileUpload({
            type : "post",
            fileElementId : fileId,
            secureuri : false,
            dataType : 'json',
            data:dat,
            url : "/upLoad/uploadBatch",
            async : true,
            success : function(data) {
                var val = data.data.sysid;
                console.log(val);
//                $("#taxproof").attr("value", val);
//                $("#dialog").dialog("close");
                alert("成功");
            },
            error : function(data) {
//                $("#dialog").dialog("close");
                alert("图片上传失败 ！！请联系管理员");
            }

        });

    });

    function downDetail(id){
        //alert(id);
        var url ="/upLoad/download/"+id+".zip";
        window.open(url);
    }

</script>

</body>
</html>
